var question_bank=[]//题类型库
var area=''//
Page({

  /**
   * 页面的初始数据
   */
  data: {
    kind:'',//题的种类
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that=this;
    wx.request({
      url: 'http://10.20.58.235:8080/v1/open/question/manager/lookarea',
      method:'GET',
      header:{
        'content-type': 'application/json;charset=UTF-8 ',
      },
      success:function(res){
        that.setData({
          kind: res.data
        })
        //console.log(that.data.kind)
      },fail:function(res){
        wx.showToast({
          title: '请求失败...',
          duration:2000,
          icon:'none'
        })
      }
    })
  },
  //复选框
  checkboxChange: function (res) {
    var that=this;
    //console.log('++++++', res.detail.value);
    question_bank = res.detail.value
  },
  //提交并跳转
  jump:function(res){
    var that=this;
    //console.log('-------------',question_bank)
    console.log(question_bank.length)
    if(question_bank.length<=3){
      wx.request({
        url: 'http://10.20.58.235:8080/v1/open/question/manager/',
        method: 'POST',
        header: {
          'content-type': 'application/json;charset=UTF-8',
        },
        success: function (res) {
          that.setData({
            area: res
          })
          console.log(that.data.area)
        }
      })
    }else{
      wx.showModal({
        title: '选择失败',
        content: '最多只能选择三种分类。',
      })
    }
  }
})